﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CMN.Entity;
using CMN.Common;
using CMN.Framework;
using CMN.BLL;
namespace CMN.UI
{
    /// <summary>
    /// 友情链接
    /// </summary>
    public class Normal_KeywordDisplay
    {
        static Normal_KeywordDisplay()
        {
           
            BaseTemplateDisplay.OnIndexPageDisplay+=new EventHandler<TemplateDisplayArg>(BaseTemplateDisplay_OnIndexPageDisplay);
        }

     
        

        /// <summary>
        /// 友情链接绑定模板
        /// </summary>
        /// <param name="o"></param>
        /// <param name="arg"></param>
        private static void BaseTemplateDisplay_OnIndexPageDisplay(object o, TemplateDisplayArg arg)
        {
           
                Normal_KeywordDisplay searchContentDisplay = new Normal_KeywordDisplay();
                arg.NvelocityTemplate.Put("keyword", searchContentDisplay);
            
        }
        /// <summary>
        /// 获取公告列表
        /// </summary>
        /// <param name="showNum"></param>
        /// <param name="cacheSecends">缓存秒数</param>
        /// <returns></returns>
        public List<Normal_KeywordEntity> List(int showNum, int cacheSecends)
        {
            QueryParam qp=new QueryParam();
            qp.PageSize=showNum;
            qp.PageIndex=1;
            qp.Orderfld="id desc ";

            List<Normal_KeywordEntity> noticeList = MvcWebCacheManager.GetNormal_KeywordList(qp, cacheSecends);
            return noticeList;
        }

        /// <summary>
        /// 获取公告列表
        /// </summary>
        /// <param name="strOrderby"> id searchNum</param>
        /// <param name="showNum"></param>
        /// <param name="cacheSecends"></param>
        /// <returns></returns>
        public List<Normal_KeywordEntity> List(string strOrderby, bool isHot, int showNum, int cacheSecends)
        {
            QueryParam qp = new QueryParam();
            qp.PageSize = showNum;
            qp.PageIndex = 1;
            qp.Orderfld = string.Concat(strOrderby, " desc ");
            if(isHot)
            qp.Where = " ishot=1";
            List<Normal_KeywordEntity> noticeList = MvcWebCacheManager.GetNormal_KeywordList(qp, cacheSecends);
            return noticeList;
        }
      
       


    }

}
